package edu.zju.gis.dbfg.model.base;

import lombok.Getter;
import lombok.Setter;

import static edu.zju.gis.dbfg.common.constant.TileConstant.*;

@Getter
@Setter
public class ScreenTile {

    private GeoItem[][] point;

    public ScreenTile() {
        this.point = new GeoItem[SCREEN_TILE_SIZE][SCREEN_TILE_SIZE];
    }

    public boolean hasPlaced(int x, int y) {
        return point[x][y].getFid() != null;
    }

    public void place(int x, int y, GeoItem gi) {
        point[x][y] = gi;
    }

    public void replace(int x, int y, GeoItem gi) {
        GeoItem ogi = point[x][y];
        if (gi.getGeometry().getArea() > ogi.getGeometry().getArea()) {
            point[x][y] = gi;
        }
    }

}
